$(document).ready(function () {
    $('#main-tab a').click(function (e) {
        e.preventDefault();
        $(this).tab('show');
    });

    //blur added <-- commented this so it wont be clickable
	//$(".showmessage").click(function(){
	//$(".showonclick").toggle();
	//  });

	  $('.blured-list').foggy();

    // pagination margins
    var length = $('.pagination li a').length;
    for (var a = 0; a <= length; a++) {
        if (a == length - 1) {
            $('.pagination li:nth-child(' + a + ')').find('a').addClass('pagi-margin-item1');
        } else if (a == (length - length) + 2) {
            $('.pagination li:nth-child(' + a + ')').find('a').addClass('pagi-margin-item2');
        }

    }


		//slider for age of create profile
		$("#slider-range").slider({
			 range: true,
			 min: 10,
			 max: 120,
			 values: [75, 300],
			 slide: function (event, ui) {
				  $("#age-from").val(ui.values[0]).css('text-align', 'center');
				  $("#age-to").val(ui.values[1]).css('text-align', 'center');
			 }
		});
		$("#age-from").val($("#slider-range").slider("values", 0));
		$("#age-to").val($("#slider-range").slider("values", 1));
 


  //table jquery to make the first column look disables and its style




  //crop javascript method

  $('#dragon').imgAreaSelect({
	 aspectRatio: '4:3',
	 handles: true
  });

  $('#thumbnail .close').on('click', function(){
  		$('#dragon').imgAreaSelect({
			 hide: true
		});
  });
  $('#thumbnail').on('hide.bs.modal', function(){
  		$('#dragon').imgAreaSelect({
			 hide: true
		});
  });



  //toggle slide in search
  var hidden = $('#second, #third, #fourth');
  $(hidden).hide();
  $('#first > div').removeClass('col-lg-4 col-md-4').addClass('col-lg-12 col-md-12 no-padding');
  $('#first > div .date-width').removeClass('date-width').addClass('date');
  $('#first > div:last-child').after('<div class="col-lg-12 col-md-12 button" />');
  $('#first .button').append('<button type="button" class="btn btn-success center-block advanced-btn">Submit</button> ');


	 //javascript to add classes to the range to change its style
	 $('#slider-range').addClass('full-slider-body');
	 $('.ui-slider-range').addClass('range-bg');
	 $('.ui-slider-handle.ui-corner-all').addClass('corner-circle-red');

	 // checkbox javascript to include ths styles.

	 //this is for the setting.php the to change the check into cross(times)
	 $('#notification input[type="checkbox"]').checkbox({
		  buttonStyle: 'btn-danger',
		  buttonStyleChecked: 'btn-danger',
		  checkedClass: 'fa fa-square-o',
		  uncheckedClass: 'fa fa-square-o',
		});

	 $('input[type="checkbox"]').checkbox({
		  buttonStyle: 'btn-danger',
		  buttonStyleChecked: 'btn-danger',
		  checkedClass: 'fa fa-check-square-o',
		  uncheckedClass: 'fa fa-square-o',
		});
	 

	 //popover of facebook promise
	 $(".facebook-promise").popover({ 
	 		trigger: "hover" ,
	 		html: true
	 });

	 //images with checkbox- facebook select
	 $('.modal-body span.form-control').removeClass('form-control');
	 $('#profile-select input[type="checkbox"]').on('click', function(){
	 	if(this.checked){
		 	$('#profile-images button span.fa-check-square-o').css('display', '');
		 	$('#profile-images button span.fa-square-o').css('display', 'none');
	 	}else{
	 		$('#profile-images button span.fa-check-square-o').css('display', 'none');
		 	$('#profile-images button span.fa-square-o').css('display', '');
	 	}
	 });
	 $('#tagged-select input[type="checkbox"]').on('click', function(){
	 	if(this.checked){
		 	$('#tagged-images button span.fa-check-square-o').css('display', '');
		 	$('#tagged-images button span.fa-square-o').css('display', 'none');
	 	}else{
	 		$('#tagged-images button span.fa-check-square-o').css('display', 'none');
		 	$('#tagged-images button span.fa-square-o').css('display', '');
	 	}
	 });
	 //SEARCH DROP DOWN
	 $('#advance-search1').on('click', function(){
		 var text = $('#advance-search1').text();

		 if(text == "Advance Search"){
			 $(this).text('Close');
			 $("#first").hide(1,function(){
			     $("#second").show();
				  $("#third").show();
				   $("#fourth").show();
				   $("#fifth").show();
			 });
		 }else{
		          $("#second").hide();
				  $("#third").hide();
				  $("#fourth").hide();
				  $("#fifth").hide();
				  $("#first").show();
			 $(this).text('Advance Search');
		 }


  });
	 //delete setting
	function radioValue(element){
		if(element.val() == 'delete'){
			$('#setting-btn').text('Next');
		}else{
			$('#setting-btn').text('Save');
		}
	}
	$('input[name="delete-setting1"]:radio').on('click', function(){
		radioValue($('input[name="delete-setting1"]:radio:checked'));
	});
	$('#setting-btn').on('click', function(){
		$('#delete-next').removeClass('setting-delete-hide');
		$('#f > div:first-child').addClass('setting-delete-hide');

	});

	//PAGE 2
	function showNext(element){
		var ace = element.next();
		console.log(ace);
		ace.show();
	}
	$('.hiddden-setting').hide();
	$('input[name="delete-select"]:radio:checked').parent().parent().next().show();
	$('input[name="delete-select"]:radio').on('click', function(){
			$('input[name="delete-select"]:radio:checked').parent().parent().next().show();
			$('input[name="delete-select"]:radio:not(:checked)').parent().parent().next().hide();
	});

	// adding blur into the visitors page;
	$('.blur-me').foggy();
	//visitor blur
	$('.upgrade-up > div > div:last-child').removeClass('col-sm-12').addClass('col-sm-4 col-sm-offset-4');


 }); //
	 

	 //select forms
$(window).on('load', function () {

	 $('.selectpicker').selectpicker({
		  'selectedText': 'cat'
	 });

	 // $('.selectpicker').selectpicker('hide');



	
});
